<?php
use Think\Controller;

class WidgetController extends HomeController
{

    function display($tpl = "")
    {
        $tplname = $this->WidgetViewUrl;
        if ($tpl) {
            if (is_file($tpl)) {
                $tplname = $tpl;
            } else {
                $tpl_array = explode("/", $tpl . ".html");
                $tpl_array_2 = explode("/", $tplname);
                $l2 = count($tpl_array);
                $l = count($tpl_array_2);
                for ($i = $l2; $i > 0; $i--) {
                    $tpl_array_2[$l - $i] = $tpl_array[$i - 1];
                }
                $tplname = implode("/", $tpl_array_2);
            }
        }
        parent::display($tplname);
    }


    public function __call($name, $arguments)
    {
        throw new \Exception(L('_Widget_Act_NOT_EXIST_') . $name);
    }


}